function [foc, share_jt, markup_jt, deriv_jt, ielas_jt, der_jt] = f_equilibrium( ...
    price_jt,   ...
    w_sharp,    ...
    theta,      ...
    Pi,         ...
    rho,        ...
    x_jt,       ...
    xnonlin_jt, ...
    xi_jt,      ...
    dfull_jt,   ...
    mcost_jt,   ...
    bc_jt,      ...
    bmc_jt,     ...
    firmid_jt  ...
)
    [share_jt, der_jt] = f_share( ...
        price_jt,   ...
        theta,      ...
        Pi,         ...
        rho,        ...
        x_jt,       ...
        xnonlin_jt, ...
        xi_jt,      ...
        dfull_jt    ...
    );

    der_jt = w_sharp*der_jt;

    markup_jt = f_markup(share_jt, der_jt, bc_jt, bmc_jt, firmid_jt);
    foc = price_jt - mcost_jt - markup_jt;
    deriv_jt = diag(der_jt);
    
    div0_jt     = sum(der_jt' ./  repmat(diag(der_jt), [1 size(der_jt,1)]),2);
    emat_jt    = der_jt .* repmat(price_jt', [size(der_jt, 1) 1]) ./ repmat(share_jt, [1 size(der_jt, 1)]);
    ielas_jt   = diag(emat_jt) .* div0_jt;
end
